﻿using EasyDDD.Domain;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyDDD.Infrastructure.EFCore.Records
{
    public abstract class RecordsBase<TContext, TEntiy> : IRecordsBase<TEntiy>
        where TContext : EFRecordsContext<TContext>
        where TEntiy : class
    {
        protected virtual TContext DbContext { get; set; }

        protected RecordsBase(TContext DbContext)
        {
            this.DbContext = DbContext;
        }

        public IQueryable<TEntiy> AsQueryable()
        {
            return DbContext.Set<TEntiy>().AsNoTracking()
                .AsQueryable();
        }

    }
}
